<template>
  <!-- 弹出框一 -->
  <vol-box :lazy="true" v-if="model1" v-model="model1" title="库位明细" :width="1200" :height="1500" :padding="5"
    :onModelClose="onModelClose">
    <!-- <div style="height:400px;">弹出1框内容, 选中传入的行数据
      <p>
        {{ JSON.stringify(model1Rows) }}
      </p>
    </div> -->
    <vol-table :url='$api.wmsInventory + "GetInvDetailByPage"' :columns="columns" :maxHeight="800"
      :pagination-hide="false" @loadBefore='loadBefore' :load-key="false" :text-inline="false" :columnIndex="false"
      :ck="false"></vol-table>
    <template #footer>
      <div>
        <!-- <el-button type="primary" plain size="small" @click="callParent">调用生成(父)页面对象</el-button> -->
        <el-button type="primary" size="small" @click="closeModel1">确认</el-button>
        <el-button type="default" size="small" @click="model1 = false">关闭</el-button>
      </div>
    </template>
  </vol-box>


</template>
<script>
import VolBox from '@/components/basic/VolBox.vue';
import VolTable from "@/components/basic/VolTable.vue";

//这里使用的vue2语法，也可以写成vue3语法
export default {
  emits: ['parentCall'],
  components: { 'vol-box': VolBox, VolTable },
  methods: {},
  data() {
    return {
      model1: false,
      model1Rows: [], //弹出框1传入的选中行
      model2: false,
      model2Row: {},//弹出框2点击的当前行数据
      tableData: [
        { MaterialId: 1, MaterialName: '物料1', MaterialCode: 'M001', MaterialSpec: '规格1', MaterialUnit: '单位1' },

      ],
      columns: [
        { field: "WarehouseCode", title: "仓库编码", type: "bigint", width: 110, showOverflowTooltip: true, align: "left" },
        { field: "WarehouseName", title: "仓库名称", width: 110, showOverflowTooltip: true, align: "left" },
        { title: '库位编码', field: 'StockCode', },
        { title: '物料编码', field: 'MaterialCode', },
        { title: '物料名称', field: 'MaterialName', },
        { title: '库存数量', field: 'Qty', },
      ],
      query: {
        page: 1,
        size: 10
      }
    };
  },
  methods: {
    openModel1(rows) { //弹出框1
      this.model1Rows = rows;
      this.model1 = true;
    },
    loadBefore(param, callBack) {

      param.WarehouseId = this.model1Rows.WarehouseId
      param.MaterialId = this.model1Rows.MaterialId

      callBack(true);
    },


    closeModel1() {
      this.model1 = false;
    },

    // callParent() {
    //   this.$emit('parentCall', $parent => {
    //     //$parent就是生成页面的对象，比如可以调用页面刷新，可获取的属性与方法见【生成页面文档】,$parent.xxx直接调用
    //     //调用刷新
    //     $parent.search();
    //     //获取所有选中的行数据
    //     // $parent.getSelectRows();
    //     this.$message.success('调用了刷新')
    //   })
    // },
    onModelClose() {
      //this.$message.success('弹出框右上角点击x关闭事件')
    }
  }
};
</script>